/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pojos;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author A7med Kotb
 */
@Entity
@Table(name = "currencies")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Currencies.findAll", query = "SELECT c FROM Currencies c"),
    @NamedQuery(name = "Currencies.findByCurrId", query = "SELECT c FROM Currencies c WHERE c.currId = :currId"),
    @NamedQuery(name = "Currencies.findByCurrencyName", query = "SELECT c FROM Currencies c WHERE c.currencyName = :currencyName"),
    @NamedQuery(name = "Currencies.findByCurrencyCode", query = "SELECT c FROM Currencies c WHERE c.currencyCode = :currencyCode")})
public class Currencies implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = true)
   
    @Column(name = "curr_id")
    private Integer currId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "currency_name")
    private String currencyName;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "currency_code")
    private String currencyCode;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "currency")
    private Collection<SourceCode> sourceCodeCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "currency")
    private Collection<Employees> employeesCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "currency")
    private Collection<Expenses> expensesCollection;

    public Currencies() {
    }

    public Currencies(Integer currId) {
        this.currId = currId;
    }

    public Currencies(Integer currId, String currencyName, String currencyCode) {
        this.currId = currId;
        this.currencyName = currencyName;
        this.currencyCode = currencyCode;
    }

    public Integer getCurrId() {
        return currId;
    }

    public void setCurrId(Integer currId) {
        this.currId = currId;
    }

    public String getCurrencyName() {
        return currencyName;
    }

    public void setCurrencyName(String currencyName) {
        this.currencyName = currencyName;
    }

    public String getCurrencyCode() {
        return currencyCode;
    }

    public void setCurrencyCode(String currencyCode) {
        this.currencyCode = currencyCode;
    }

    @XmlTransient
    public Collection<SourceCode> getSourceCodeCollection() {
        return sourceCodeCollection;
    }

    public void setSourceCodeCollection(Collection<SourceCode> sourceCodeCollection) {
        this.sourceCodeCollection = sourceCodeCollection;
    }

    @XmlTransient
    public Collection<Employees> getEmployeesCollection() {
        return employeesCollection;
    }

    public void setEmployeesCollection(Collection<Employees> employeesCollection) {
        this.employeesCollection = employeesCollection;
    }

    @XmlTransient
    public Collection<Expenses> getExpensesCollection() {
        return expensesCollection;
    }

    public void setExpensesCollection(Collection<Expenses> expensesCollection) {
        this.expensesCollection = expensesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (currId != null ? currId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Currencies)) {
            return false;
        }
        Currencies other = (Currencies) object;
        if ((this.currId == null && other.currId != null) || (this.currId != null && !this.currId.equals(other.currId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pojos.Currencies[ currId=" + currId + " ]";
    }
    
}
